//
//  Extensions.swift
//  CollapsibleTtableSection
//
//  Created by apple on 16/12/26.
//  Copyright © 2016年 com.zaoguankeji.www. All rights reserved.
//



import UIKit

extension UIColor {

    convenience init(_ hex: Int, alpha: CGFloat = 1.0) {
    
    self.init(
         red: CGFloat((hex & 0xFF0000) >> 16)/255.0,
         green: CGFloat((hex & 0x00FF00) >> 8)/255.0,
         blue: CGFloat((hex & 0x0000FF) >> 0)/255.0,
         alpha: alpha
        )

    }


}

extension UIView {
    func rotate(_ toValue: CGFloat, duration: CFTimeInterval = 0.2) {
        
        let animation = CABasicAnimation(keyPath: "transform.rotation")
        animation.toValue = toValue
        animation.duration = duration
        animation.isRemovedOnCompletion = false
        animation.fillMode = kCAFillModeForwards
        
        self.layer.add(animation, forKey: nil)
    }
}


extension NSString {
   public var iVersion: String  { return UIDevice.current.systemVersion}
}

